<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"

      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core">

    <h:head>
        <title>iNET- Login Tiện ích văn phòng</title>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <link rel="shortcut icon" href="../resources/images/logo.png" />
        <h:outputStylesheet library="css" name="menu.css"/>
        <h:outputStylesheet library="css" name="style.css"/>

    </h:head>
    <h:body>
        <h:form>

            <!--Start header-->
            <ui:include src="/resources/template/header.xhtml"/>
            <!--end header-->

            <div class="main">
                <!-- Menu left-->

                <ui:include src="/resources/template/left.xhtml"/>

                <!--end menu left-->

                <!--nội dung-->
                <div class="right"> <br/>
                    <p class="tieude">Danh sách chấm công phòng: <h:outputText value="#{userController.dep.dep_name}"/></p>
                    <h:panelGroup rendered="#{userController.userActive.isAdmin}">
                        <div class="controll">
                            <h:inputText id="name" styleClass="input" pt:placeholder="Tên nhân viên"/>
                            <h:selectOneMenu id="txtTrungTam" styleClass="input">
                                <f:selectItem itemLabel="---Trung Tâm---" itemValue="1"/>
                                <f:selectItem itemLabel="Trung tâm INEW" itemValue="2"/>
                                <f:selectItem itemLabel="Trung tâm SEO" itemValue="3"/>
                                <f:selectItem itemLabel="Trung tâm SMS" itemValue="4"/>
                            </h:selectOneMenu>
                            <h:selectOneMenu id="txtPhongBan" styleClass="input">
                                <f:selectItem itemLabel="---Phòng Ban---" itemValue="1"/>
                                <f:selectItem itemLabel="Phần Mềm" itemValue="5"/>
                                <f:selectItem itemLabel="Maketting" itemValue="6"/>
                                <f:selectItem itemLabel="Kết toán" itemValue="7"/>
                                <f:selectItem itemLabel="Nghiên cứu" itemValue="8"/>
                            </h:selectOneMenu>
                            <h:commandButton styleClass="btnSubmid" value="Tìm" type="reset"></h:commandButton>
                        </div>
                    </h:panelGroup>
                    <table id="noteTime" class="zebra">
                        <tr>
                            <td colspan="6"><strong>Chú thích:</strong></td>
                        </tr>
                        <tr>
                            <td><strong>0</strong> Nghỉ cả ngày có phép.</td>
                            <td><strong>-0.5</strong> Nghỉ nửa ngày không phép.</td>
                            <td><strong>-1</strong> Nghỉ cả ngày không phép.</td>
                            <td><strong>1</strong> Đi làm đúng giờ.</td>
                            <td><strong>0.5</strong> Đi làm nửa ngày.</td>
                            <td><strong>1*</strong> Đi muộn có phép.</td>
                            <td><strong>x</strong> Nghỉ thứ 7, Chủ nhật.</td>
                        </tr>
                    </table>
                    <br/>
                    <table align="center">
                        <tr>
                            <td>
                                <h:dataTable class="bordered" value="#{timeKeepController.getListTK()}" var="o">
                                    <h:column >
                                        <f:facet name="header">ID</f:facet>
                                        <h:outputText value="#{o.emp.emp_code}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header" >Họ và tên</f:facet>
                                        <h:outputText value="#{o.emp.first_name} "></h:outputText>
                                        <h:outputText value="#{o.emp.last_name} "></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">01</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day1)}">
                                            
                                        </h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">02</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day2)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">03</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day3)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">04</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day4)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">05</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day5)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">06</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day6)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">07</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day7)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">08</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day8)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">09</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day9)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">10</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day10)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">11</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day11)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">12</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day12)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">13</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day13)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">14</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day14)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">15</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day15)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">16</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day16)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">17</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day17)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">18</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day18)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">19</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day19)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">20</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day20)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">21</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day21)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">22</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day22)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">23</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day23)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">24</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day24)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">25</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day25)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">26</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day26)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">27</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day27)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">28</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day28)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">29</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day29)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">30</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day30)}"></h:outputText>
                                    </h:column>
                                    <h:column>
                                        <f:facet name="header">31</f:facet>
                                        <h:outputText value="#{timeKeepController.convertData(o.day31)}"></h:outputText>
                                    </h:column>
                                    <h:column rendered="#{ userController.userActive.isManager}">
                                        <f:facet name="header"></f:facet>
                                        <h:commandLink value="Sửa" action="#{timeKeepController.editTK(o.tk_id)}"></h:commandLink>
                                    </h:column>
                                </h:dataTable>
                            </td>
                        </tr>
                        <h:panelGroup rendered="#{userController.userActive.isManager}">
                            <div class="note">
                                <h:outputLabel class="ghichu" value="Ghi chú tháng #{userController.note.note_date}"></h:outputLabel> - 
                                <h:outputLabel class="lastupdate" value="Cập nhật lần cuối lúc: #{userController.note.last_update}"></h:outputLabel>
                                <div>   
                                    <div style="width: 90%; float: left">
                                        <h:inputTextarea value="#{userController.note.content}"></h:inputTextarea>
                                    </div>
                                    <div style="margin-left: 3px;">
                                        <h:commandButton rendered="#{not userController.userActive.isAdmin}" class="btnSubmid" onclick="if (!confirm('Bạn muốn cập nhật ghi chú?'))
                                                    return false;" action="#{userController.updateNote()}" value="Lưu" ></h:commandButton>
                                    </div>
                                </div>
                            </div>
                        </h:panelGroup>

                    </table>
                    <br/>

                </div>
                <!-- end dội dung-->
            </div>
            <!--Footer-->
            <ui:include src="/resources/template/footer.xhtml"/>
            <!--end footer-->

        </h:form>
    </h:body>
</html>

